{extend name="index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <input type="hidden" name="id" value="{$data.id}">
    <input type="hidden" name="goods_cate" value="{$data.goods_cate}">
<!--    0陪诊 1医疗用品 2优惠卷-->
    {if $data.goods_cate==2}
    <div class="layui-form-item c1" >
        <label class="layui-form-label">优惠卷</label>
        <div class="layui-input-block">
            <select name="object_id">
                {if !empty($coupons_list)}
                {foreach $coupons_list as $key}
                <option <?php if( $key['id'] == $data['object_id']){ ?>selected<?php }?>value="{$key.id}" name=object_id>{$key.name}</option>
                {/foreach}
                {/if}
            </select>
        </div>
    </div>
    {/if}

    {if $data.goods_cate==0}
    <div class="layui-form-item c2" >
        <label class="layui-form-label">陪诊服务</label>
        <div class="layui-input-block">
            <select name="pz_object_id">
                {if !empty($server_list)}
                {foreach $server_list as $key2}
                <option <?php if( $key2['id'] == $data['object_id']){ ?>selected<?php }?>value="{$key2.id}" name=pz_object_id>{$key2.name}</option>
                {/foreach}
                {/if}
            </select>
        </div>
    </div>
    {/if}

    {if $data.goods_cate==1}
    <div class="layui-form-item c3" >
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" id="c3" autocomplete="off" placeholder="名称"
                   class="layui-input" value="{$data.name}">
        </div>
    </div>


    <div class="layui-form-item c4" >
        <label class="layui-form-label">主图</label>
        <div class="layui-input-block">
            <input type="text" name="img" id="c-pic" class="layui-input" value="{$data.img}">
        </div>
        <div class="layui-input-block">
            <button type="button" class="layui-btn faupload" id="faupload-pic" data-multiple="false" data-input-id="c-pic"
                    data-preview-id="p-pic" data-type="image"><i class="layui-icon layui-icon-upload"></i> 上传
            </button>
            <button type="button" class="layui-btn fachoose" data-multiple="false" data-mimetype="image"
                    data-input-id="c-pic" id="fachoose-c-pic"><i class="iconfont icon-other"></i> 选择
            </button>
            <ul class="layui-row list-inline plupload-preview" id="p-pic"></ul>
        </div>
    </div>

    <div class="layui-form-item c5" >
        <label class="layui-form-label">规格说明</label>
        <div class="layui-input-block">
            <textarea id="c5" name="specs" placeholder="规格说明"  class="layui-textarea">{$data.desc}</textarea>
        </div>
    </div>

    <div class="layui-form-item c6" >
        <label class="layui-form-label">内容详情</label>
        <div class="layui-input-block">
            <script type="text/plain" class="js-ueditor" name="content" id="c6"
                    style="width:900px;height:200px;position: relative;z-index: 1 !important;"
                    id="content">{$data['content']|default=''|raw}</script>
        </div>
    </div>
    {/if}

    <div class="layui-form-item">
        <label class="layui-form-label">所需积分</label>
        <div class="layui-input-block">
            <input type="number" name="points" value="{$data.points}" lay-verify="required" autocomplete="off" placeholder="所需积分"
                   class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input type="Number" name="sort" value="{$data.sort}" lay-verify="required" autocomplete="off" placeholder="排序"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">库存</label>
        <div class="layui-input-block">
            <input type="Number" name="inventory" value="{$data.inventory}" lay-verify="required" autocomplete="off" placeholder="库存"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">已兑换数量</label>
        <div class="layui-input-block">
            <input type="Number" name="salenum" lay-verify="required" value="{$data.salenum}" autocomplete="off" placeholder="已兑换数量"
                   class="layui-input">
        </div>
    </div>




    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['yznForm','form'], function () {
        var yznForm = layui.yznForm;
        var form = layui.form;
        var $ = layui.jquery;
        yznForm.bindevent($("form.layui-form"));
    });

</script>
{/block}